<?php
// View for admin - article edit
require_once WACT_ROOT.'controller/controller.inc.php';
require_once WACT_ROOT .'controller/form.inc.php';
require_once WACT_ROOT.'view/view.inc.php';
require_once WACT_ROOT .'view/formview.inc.php';

require_once APP_ROOT . 'view/common/layout.formview.php';
require_once APP_ROOT . 'view/common/layout.view.php';

require_once 'model/common/user.php';
require_once 'model/common/article.php';
require_once 'model/common/categories.php';
require_once 'model/common/date.php';

class ArticleSubmitView extends LayoutFormView {

	var $form; // form controller

    function ArticleSubmitView($TemplateFile, &$form) {
        parent :: LayoutFormView($TemplateFile);
        $this->form = $form;
    }




    function prepare(&$controller, &$request, &$responseModel) {
    	parent::prepare($controller, $request, $responseModel);
        
		$this->Template->set('SITE_CSS',Site::getSiteTemplateCSS());
		$this->Template->set('SITE_BASE',Site::getSiteTemplateBase());
		$this->Template->set('SITE_TITLE',Site::getTitle());
 

		$this->Template->set('skip_left_menu',true);
    	$docbase="http://".$_SERVER['HTTP_HOST'];
		$this->Template->set('docbase',$docbase);
		
		$this->Template->set('app_name','.');
    	$template =& $this->Template;
    	$this->form->prepare($controller, $request, $responseModel,$template);
    	$start_month =& $this->Template->getChild('show_month');
    	return;

/*
        $pager =& $this->Template->getChild('pagenav');
        $pager2 =& $this->Template->getChild('pagenav2');
        $list =& Article::getArticlesList($pager,$request);
        $list->paginate($pager2);


        $list_updated=array();


        $list->reset();
        while ($list->next()) {

        	$dataspace = $list->export();
            $firstname = $list->get('firstname');
            $lastname = $list->get('lastname');
            $author_show = $firstname.' '.$lastname;
            $dataspace['author_show'] =  $author_show;

            $category1 = $list->get('category1');
            $category2 = $list->get('category2');

            $category_show = $category1.'-'.$category2;
            $dataspace['category_show'] =  $category_show;

            $premium = $list->get('premium');
            if ($premium) $dataspace['premium_show'] =  1;


            $list_updated[$user_id] = $dataspace;
        }


        $list_source_updated =& new ArrayDataSet($list_updated);
        $this->Template->setChildDataSource('List', $list_source_updated);






        //populate categories
        $categories1 =& CategoriesModel::getSportCategories(false,false);
        //print_r($categories1);
        $categories2 =& CategoriesModel::getCommunityCategories(false,false);
        $category1 =& $this->Template->getChild('category1');
        $category2 =& $this->Template->getChild('category2');
        $category1->setChoices($categories1);
        $category2->setChoices($categories2);

        //populate authors
        $authors_list =& User::getAuthorsList();
        $author =& $this->Template->getChild('author');
        $author->setChoices($authors_list);*/
    }

}






?>